﻿/**
 * Peter
 * Created by: Peter Development Team
 *    http://peter.codeplex.com/
 * 
 * GNU General Public License version 2 (GPLv2)
 *    http://peter.codeplex.com/license
 *
 *  This code is provided on an AS IS basis, with no WARRANTIES,
 *  CONDITIONS or GUARANTEES of any kind.
 *  
 **/

using System.Windows.Input;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Peter.Common;
using Peter.Common.Services;
using Peter.Logic;
using Peter.Logic.Interfaces;

namespace Peter.Tests.Logic
{
   /// <summary>
   /// Test cases for the quick open model.
   /// </summary>
   [TestClass]
   public class ModelQuickOpenTests
   {
      /// <summary>
      /// Tests the constructor.
      /// </summary>
      [TestMethod]
      public void TestModelQuickOpenConstructor ()
      {
         var appMain = new MockAppMain ();
         ServiceManager.AddSingleton <IAppMain, MockAppMain> (appMain);
         var model = new ModelQuickOpen ();
         Assert.IsNotNull (model.QuickOpenMenuItem);
         Assert.IsTrue (appMain.MainWindow.CommandBindings.Count == 1);
         Assert.AreEqual (PeterApplicationCommands.QuickOpen, appMain.MainWindow.CommandBindings[0].Command);
         ServiceManager.Clear ();
      }

      /// <summary>
      /// Tests the quick open command.
      /// </summary>
      //[TestMethod]
      public void TestQuickOpenCommand ()
      {
         var appMain = new MockAppMain ();
         ServiceManager.AddSingleton<IAppMain, MockAppMain> (appMain);
         var model = new ModelQuickOpen ();
         ICommand command = PeterApplicationCommands.QuickOpen;
         command.Execute (null);
         Assert.IsTrue (model.IsFocused);
         ServiceManager.Clear ();
      }
   }
}
